<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="css/amazeui.min.css" />
    <link rel="stylesheet" href="css/index_2.css" />
    <link rel="stylesheet" type="text/css" href="css/pageCode.css">
    <title>创业会员</title>
    <style>
        .jfsj>p {
            line-height: 25px;
        }
    </style>
</head>

<body>
    <!--头部-->
    <header class="am-u">
        <div class="am-u-sm-12 head_nav" style="margin:0;">
            <div class="am-u-sm-2 am-vertical-align">
                <a href="Myclient.html">
                    <img src="img/return@2x.png" class="am-vertical-align-middle" alt="" />
                </a>
            </div>
            <div class="am-u-sm-8 head_text">

            </div>
            <div class="am-u-sm-2">

            </div>
        </div>
    </header>
    <!--修改密码输入框-->
    <div style="clear:both"></div>
    <div style="line-height:35px;padding-left:10px;background:#ccc;color:#41A0F0;">当前下级个数：
        <span id="count"></span>个</div>
    <div class="am-u" id="xj_list" style="padding: 10px;">
        <!--			<div class="am-u-sm-12" style="background: #fff;padding: 10px;">
				<div class="am-u-sm-3" style="text-align: left;padding:0;">
					<img src="img/portrait@2x.png" alt=""  width="50" style="margin-top:25px;"/>
				</div>
				<div class="am-u-sm-6 jfsj" style="padding: 0;font-size: 13px;">	
					<p style="margin-bottom: 0;">
                                            <img src="img/sevice_member@2x.png" style="width:21px;margin-top:-2px;">
                                            <span> 0</span>
					</p>
					<p style="margin:0;">
                                            <img src="img/sevice_phone@2x.png" style="width:21px;margin-top:-2px;">
                                            <span style="color:#B5324E"> 0</span>
					</p>
					<p style="margin:0;">
                                            <img src="img/sevice_time@2x.png" style="width:21px;margin-top:-2px;">	
                                            <span style="color:#517E2E">2015-12-12 12:45</span>
					</p>
					<p style="margin:0;">
                                            <img src="img/sevice_ver@2x.png" style="width:21px;margin-top:-2px;">
                                            <span style="color:#E0A36F"> 38</span>
					</p>
				</div>
                                <div class="am-u-sm-3" style="text-align: left;color:#41A0F0;line-height:100px;padding:0;font-size:14px;text-align: right;">
                                    联系他/她
				</div>
			</div>-->
    </div>
    <div class="tcdPageCode" style="color: red;text-align: center;"></div>
    <div style="clear: both;"></div>

    <script src="js/jquery-1.11.3.js"></script>
    <script src="js/jquery.page.js"></script>
    <script src="js/loading.js"></script>
    <script>
        var you = location.search.replace(/[^0-9]/ig, "");
        if (you == 1) {
            $(".head_text").html("创业会员");
        } else if (you == 2) {
            $(".head_text").html("超级会员");
        } else if (you == 3) {
            $(".head_text").html("黄金代理");
        } else if (you == 4) {
            $(".head_text").html("钻石代理");
        } else if (you == 5) {
            $(".head_text").html("市分公司");
        } else if (you == 6) {
            $(".head_text").html("省级代理");
        }
        var token1 = sessionStorage['token'];
        var method1 = "get_levelmember";
        //         第几页
        var p1 = 1;
        //          每页几条数据
        var pagesize1 = 5;
        $.ajax({
            type: 'POST',
            url: "http://www.rice.com/app/api/h5_access",
            contentType: "application/x-www-form-urlencoded; charset=utf-8",
            datatype: "JSON",
            data: {
                method: method1,
                token: token1,
                level: you,
                p: p1,
                pagesize: pagesize1
            },
            success: function (data) {
                var data1 = JSON.parse(data);
                if (data1.status === 1) {
                    var html = "";
                    var data = data1.data.res
                    for (var i in data) {
                        var hh = data[i].reg_time;
                        var date = new Date(hh * 1000);
                        var Y = date.getFullYear() + '-';
                        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() +
                            1) + '-';
                        var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
                        var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
                        var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes());
                        if (data[i].realname_confirm == 0) {
                            var sm = "未实名";
                        } else {
                            var sm = "已认证";
                        }
                        if (data[i].is_vip == 0) {
                            var am = "未激活";
                        } else {
                            var am = "已激活";
                        }
                        if (data[i].img_head !==
                            "http://www.rice.com/Public/upload/userhead/20180102083954/vv758.png" && data[i]
                            .img_head !== null) {
                            var img_head = data[i].img_head;
                        } else {
                            var img_head = "img/portrait@2x.png";
                        }
                        html +=
                            '<div class="am-u-sm-12" style="background: #fff;padding: 10px;margin-bottom:10px"><div class="am-u-sm-3" style="text-align: center;padding:0;"><img src="' +
                            img_head +
                            '" alt=""  width="50" style="margin-top:25px;"/><p style="margin:0;font-size:14px;color:#41A0F0;">' +
                            data[i].relation_name +
                            '</p></div> <div class="am-u-sm-6 jfsj" style="padding: 0;font-size: 13px;"><p style="margin-bottom: 0;"><img src="img/sevice_member@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">';
                        html += '<span>' + data[i].level_name + '</span>';
                        html +=
                            '</p><p style="margin:0;"><img src="img/sevice_phone@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">';
                        html += '<span style="color:#B5324E">' + data[i].login_name + '</span>';
                        html +=
                            '</p><p style="margin:0;"><img src="img/sevice_time@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">';
                        html += '<span style="color:#517E2E">' + Y + M + D + h + m + '</span>';
                        html +=
                            '</p><p style="margin:0;"><img src="img/sevice_ver@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">';
                        html += '<span style="color:#E0A36F">' + sm + '/' + am + '</span>';
                        html += '</p></div><a href="tel:' + data[i].login_name +
                            '" class="am-u-sm-3" style="text-align: left;color:#41A0F0;line-height:100px;padding:0;font-size:14px;text-align: right;">联系TA</a></div>';
                    }
                    if (html == "") {
                        $("#xj_list").html(
                            "<div style='width:60%;margin:20px 20%;clear:both;'><img src='img/roun.png' style='width:100%;'></div>"
                        );
                        $(".tcdPageCode").css("display", "none");
                    } else {
                        $("#xj_list").html(html);
                    }
                    $("#count").html(data1.data.count);
                    var r = data1.data.count;
                    r = Math.ceil(r / pagesize1);
                    $(".tcdPageCode").createPage({
                        pageCount: r,
                        current: 1,
                        backFn: function (pagesize1) {}
                    });
                } else if (Number(data1.status) == 2) {
                    alert(data1.message);
                    window.location.href = "login.html";
                } else {
                    alert(data1.message);
                }
            }
        });
        $(".tcdPageCode").on("click", 'a', function () {
            var h = $(this).html();
            if (h == "下一页") {
                var t = $('.tcdPageCode  span.current').html();
                t = parseInt(t);
                p1 = t + 1;
            } else if (h == "上一页") {
                var t = $('.tcdPageCode  span.current').html();
                t = parseInt(t);
                p1 = t - 1;
            } else {
                h = parseInt(h);
                p1 = h;
            }
            $.ajax({
                type: 'POST',
                url: "http://www.rice.com/app/api/h5_access",
                contentType: "application/x-www-form-urlencoded; charset=utf-8",
                datatype: "JSON",
                data: {
                    method: method1,
                    token: token1,
                    level: you,
                    p: p1,
                    pagesize: pagesize1
                },
                success: function (data) {
                    var data1 = JSON.parse(data);
                    if (data1.status === 1) {
                        var html = "";
                        for (var i in data1.data.res) {
                            var hh = data1.data.res[i].reg_time;
                            var date = new Date(hh * 1000);
                            var Y = date.getFullYear() + '-';
                            var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() +
                                1) + '-';
                            var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) +
                                ' ';
                            var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) +
                                ':';
                            var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes());
                            html +=
                                `<div class="am-u-sm-12" style="background: #fff;padding: 10px;margin-bottom:10px">
                                                            <div class="am-u-sm-3" style="text-align: left;padding:0;">
                                                                    <img src="img/portrait@2x.png" alt=""  width="50" style="margin-top:25px;"/>
                                                            </div>
                                                            <div class="am-u-sm-6 jfsj" style="padding: 0;font-size: 13px;">	
                                                                    <p style="margin-bottom: 0;">
                                                                        <img src="img/sevice_member@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">`;
                            html += `<span>` + data1.data.res[i].level_name + `</span>`;
                            html +=
                                `</p>
                                                         <p style="margin:0;">
                                                            <img src="img/sevice_phone@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">`;
                            html += `<span style="color:#B5324E">` + data1.data.res[i].login_name +
                                `</span>`;
                            html +=
                                `</p>
                                                            <p style="margin:0;">
                                                                <img src="img/sevice_time@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">`;
                            html += `<span style="color:#517E2E">` + Y + M + D + h + m + `</span>`;
                            html +=
                                `</p>
                                                        <p style="margin:0;">
                                                            <img src="img/sevice_ver@2x.png" style="width:21px;margin-top:-4px;margin-right: 2px;">`;
                            html += `<span style="color:#E0A36F">` + data1.data.res[i].realname_confirm +
                                `</span>`;
                            html +=
                                `</p>
                                                        </div>
                                                        <div class="am-u-sm-3" style="text-align: left;color:#41A0F0;line-height:100px;padding:0;font-size:14px;text-align: right;">
                                                            联系他/她
                                                        </div>
                                                </div>`;
                        }
                        $("#xj_list").html(html);
                        $("#count").html(data1.data.count);
                        var r = data1.data.count;
                        r = Math.ceil(r / pagesize1);
                        $(".tcdPageCode").createPage({
                            pageCount: r,
                            current: p1,
                            backFn: function (pagesize1) {}
                        });
                    } else if (Number(data1.status) == 2) {
                        alert(data1.message);
                        window.location.href = "login.html";
                    } else {
                        alert(data1.message);
                    }
                }
            });
        })
    </script>
</body>

</html>